package com.yokit.c2c.service;

import com.yokit.c2c.mapper.UserMapper;
import com.yokit.c2c.pojo.User;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author fengzeng
 * @create 2021/6/13 20:35
 */
@Service
public class UserService {
  @Resource
  private UserMapper userMapper;

  public User selectByUsernameAndPassword(String username, String  password) {
    return userMapper.selectByUsernameAndPassword(username, password);
  }

  public User selectByUserId(Integer userId) {
    return userMapper.selectByPrimaryKey(userId);
  }

  public void createUser(User user) {
    userMapper.insertSelective(user);
  }

  public void updateUserInfo(User user) {
    userMapper.updateByPrimaryKeySelective(user);
  }
}
